#include<stdio.h>
int main()
{
	int x;
	scanf("%d",&x);
	int N;
	int R;
	while (x>0) {
		N=x%10;
		printf("%d\n",N);
		R=R*10+N;
		printf("x=%d,N=%d,R=%d\n",x,N,R);
		x/=10;
	}
	printf("%d",R);
	return 0;
}
